<?php
 if(!defined('INDEX') && !defined('ADMIN')){
    exit('Access Denied');
}
if(!defined('ADMIN') && !defined('PLUGIN')){
    define('MY_PLUGIN_KEY', 'miaozhe');
    define('MY_PLUGIN_CODE', 'miaozhe');
    include(DDROOT . '/plugin/plugin.class.php');
    $plugin_set = dd_get_cache('plugin');
    $re_key = check_plugin_auth(MY_PLUGIN_CODE, MY_PLUGIN_KEY);
    if($re_key == '888'){
        exit('不存在授权码');
    }elseif($re_key == '888'){
        exit('授权码无法解密');
    }elseif($re_key == '888'){
        exit('应用不存在或者已到期');
    }elseif($re_key == '888'){
        exit('授权码与网站不符');
    }
}

function ItemDesc($dephp_36, $dephp_29, $dephp_30 = 0, $dephp_37 = 0){
    global $duoduo;
    if($dephp_30 == 0){
        return false;
    }
    if($dephp_36 == ''){
        return false;
    }
    if($dephp_29 == 1 || $dephp_29 == 2){
        $dephp_14 = 'http://hws.m.taobao.com/cache/desc/5.0?id=' . $dephp_36 . '&type=1';
        $dephp_31 = file_get_contents($dephp_14);
        $dephp_31 = dd_json_decode($dephp_31, true);
        $dephp_38 = str_replace(array('href', 'var desc=\'', '\';', '\\'), array('rel="nofollow" ahref', '', '', ''), $dephp_31['pcDescContent']);
    }elseif($dephp_29 == 3){
        $dephp_14 = 'http://item.m.jd.com/detail/' . $dephp_36 . '.html';
        $dephp_31 = dd_get($dephp_14);
        preg_match('/<div class="scale-box" id="scale-cont">(.*)<\\/div>
				<\\/div>
            <\\/div>
    		<div class="detail" id="wareStandard">/is', $dephp_31, $dephp_31);
        $dephp_38 = str_replace('href', 'rel="nofollow" ahref', $dephp_31[1]);
    }
    if($dephp_37 == 1){
        $duoduo -> update('goods', array('content' => $dephp_38), 'data_id=' . $dephp_36);
    }
    return $dephp_38;
    unset($duoduo);
}